I’m making my 1st ever ice move
when the player pressed e 3 chunks of ice come from underground and goes in the air
when the animation is finish
the touch event will be true
if the player touches the ice they will freeze
but not the local player
this is all i got for now
local debounce = false
clone1.Touched:Connect(function(hit)
if hit.Parent:WaitForChild('Humanoid') then
if debounce == true then return end
debounce = true
--script
end
end)
i know that i could anchor the player but i want too anchor the other players who touch it
its like the local player is invincible to it but the other players who touch it will be anchored.
i dont know how to get the other players
You should’ve referred to the Player who used this move somewhere.
As for your script, you could try:
local iceCloneHit = false
clone1.Touched:Connect(function(hitPart)
if not hit or not hit.Parent or iceCloneHit then return end
local hitPlayer = game.Players:GetPlayerFromCharacter(hitPart.Parent)
if hitPlayer and hitPlayer ~= plr then -- 'plr' should be the player who used the move
iceCloneHit = true -- the ice part has hit a valid Player
-- rest of script
end
end)
local rem = game:GetService("ReplicatedStorage").RemoteEvent
local part = game:GetService("ReplicatedStorage").Part
rem.OnServerEvent:Connect(function(plr)
local char = plr.Character or plr.CharacterAdded:Wait()
local humrp = char:WaitForChild("HumanoidRootPart")
local clone1 = part:Clone()
clone1.Parent = workspace
clone1.CFrame = humrp.CFrame * CFrame.new(0,0,-3)
local iceCloneHit = false
clone1.Touched:Connect(function(hitPart)
if not hitPart.Parent or iceCloneHit then return end
local hitPlayer = game.Players:GetPlayerFromCharacter(hitPart.Parent)
if hitPlayer and hitPlayer ~= plr then
iceCloneHit = true
hitPlayer.Anchored = true
end
end)
end)
It reads hitPlayer.Anchored = true. You can not anchor a Player object itself.
local iceCloneHit = false
clone1.Touched:Connect(function(hitPart)
if not hitPart or not hitPart.Parent or iceCloneHit then return end
local hitPlayer = game.Players:GetPlayerFromCharacter(hitPart.Parent)
if hitPlayer and hitPlayer ~= plr then -- 'plr' should be the player who used the move
local pRoot = hitPart.Parent:FindFirstChild("HumanoidRootPart")
if pRoot then
iceCloneHit = true -- the ice part has hit a valid Player and they can be frozen
pRoot.Anchored = true -- pRoot is their HumanoidRootPart, a Part :)
-- rest of script
end
end
end)