Ok so, i have this magic move im making, and it throws out a shockwave right.
ok so I was wondering how I would clone a part to another player via on touched
and make them not able to move.
Basically how would I encase someone in ice and make it where they cant move then it deletes the ice and returns back to normal after a certain amount of time
Im not asking for a full script, just an example or what i need to know.
– Edit: also need to know how to do this without encasing the player who is using the move in the ice.
You can anchor all their body parts, or you can set their Humanoid’s WalkSpeed and JumpPower to 0, then restore them once you want to unfreeze the player. I would personally anchor all their body parts so you do not have to save their JumpPower and WalkSpeed, and if you have a sprinting key it won’t cause issues.
local IceBlock = Instance.new("Part")
IceBlock.BrickColor = BrickColor.new("Baby blue")
IceBlock.Size = Vector3.new(5, 7, 5)
IceBlock.Transparency = 0.5
IceBlock.Anchored = true
local Frozen = {} -- we will use this to store all of our frozen characters
function CharAnchor(Character, AnchorBool) -- anchor will be true or false
for _, CharacterPart in pairs(Character:GetChildren()) do
if CharacterPart:IsA("BasePart") then -- if the child is a basepart so we don't try to anchor scripts etc and get an error
CharacterPart.Anchored = AnchorBool
end
end
end
function FreezeCharacter(Character)
if not Frozen[Character] then -- if the Character isn't already frozen
CharAnchor(Character, true) -- anchor the character
local IceBlockClone = IceBlock:Clone()
IceBlockClone.Parent = workspace
IceBlockClone.CFrame = Character.PrimaryPart.CFrame -- move the IceBlock to the character
Frozen[Character] = IceBlockClone -- index the character with the new IceBlock
end
end
function UnFreezeCharacter(Character)
local FrozenCheck = Frozen[Character] -- Checks if the Character is frozen
if FrozenCheck then
FrozenCheck:Destroy()
CharAnchor(Character, false)
FrozenCheck = nil
end
end
wait(10)
FreezeCharacter(game.Workspace.Quoteory)
wait(2.5)
UnFreezeCharacter(game.Workspace.Quoteory)
``
This sounds like this would be something executed in a tool. In this case, you would have to use RemoteEvents and think of a smart Server-Client model.
A suggestion I have for your model is to have a parallel system: Have the client run basically the same code as there server so that
The client can have a smooth experience and not experience “input lag”
Game is resistant to exploiters (as if you do the hit checking on the client and pass a name an exploiter can pass any old name and error your script or, worse, freeze people at their will)
@Quoteory has some good code on actually freezing the player, but this post is just to get you thinking of executing that code securely and correctly.
Sorry to revive this but, this should be recorded somewhere. I was digging in the wiki once to solve this exact problem. You can actually do this by doing:
function randomThing()
return Enum.ContextActionResult.Sink
end
contextActionService:BindAction("freezeMovement",randomThing,false,unpack(Enum.PlayerActions:GetEnumItems()))