I have a script in my game that changes the player's size but the script doesn't work when ever the player is killed, could anyone help?
A few different ways to do this. One way would be to set the scale when the player respawns using the spawnedEvent
.
Example code:
local function scale_player(player)
if(Object.IsValid(player)) then
player:SetWorldScale(Vector3.ONE * 2)
end
end
Game.playerJoinedEvent:Connect(function(player)
scale_player(player)
player.spawnedEvent:Connect(scale_player)
end)
its easy to do! Follow the Steps Below:
- First Copy the Script that change the size of player
- Now Do like this:
Game.playerJoinedEvent:Connect(fuction(player)
player.diedEvent:Connect(function()
--- Paste the Script in Here...
end)
end)
- Now you are Ready!
If you need any help, dont mind to ask !
Thankyou for the help this will fix my game.
hey remove the line 9 and 10! no need of that
also no need of that function on line 5!
just do like before player.diedEvent, paste at line 6 and again paste and line inside player.diedEvent Function!
can you put together the code so I can paste it because I don't know what mean by
Here it is:
Game.playerJoinedEvent:Connect(function(player)
player:setWorldScale(Vector3.New(propPlayerScale,propPlayerScale,propPlayerScale))
player.diedEvent:Connect(function()
player:setWorldScale(Vector3.New(propPlayerScale,propPlayerScale,propPlayerScale))
end)
end)
Would I need to include script:GetCustomProperty("playerScale") to make it work?
srry my mistake that s needs to be capital like this :SetWorldScale but i made it to :setWorldScale
Still no luck but I can probably try making player seam bigger by changer the camera offset.
what's the error? can u check the output and tell me ?
yo u r custom property is wrong! u must create a int property
Just tried that and still didn't work.