Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Server Receiving Correct Data And Not Using It?

alright so my friend made a very simple script where you punch something with the proper name it it unanchors it and every of part in that model with the same name if it is a model

so i took to myself to convert it to FE and everything should work flawlessly but the server acts like nothing is happening but it does print the hit parameter so im not sure whats up

LocalScript:

local anim = Instance.new("Animation")
local id = 04675084449
local name = "DestPart"
anim.AnimationId = "http://www.roblox.com/Asset?ID="..id
local tool = script.Parent
local plr = game.Players.LocalPlayer
local deb = false
local canhit = false
local Event = game.ReplicatedStorage.Break

tool.Equipped:Connect(function(mouse)
	tool.Activated:Connect(function()
		if not deb and plr.Character:FindFirstChild("RightHand") then
			deb = not deb
			canhit = true
			local animcont = plr.Character.Humanoid:LoadAnimation(anim)
			animcont:Play()
			plr.Character:FindFirstChild("RightHand").Touched:Connect(function(hit)
				local human = hit:IsA("Part") or hit:IsA("MeshPart")or hit:IsA("UnionOperation")
				Event:FireServer(hit)
				if human and canhit and hit.Name == name then
					Event:FireServer(hit)
					print(hit)
				end
			end)
			wait(1.5)
			canhit = false
			deb = not deb
		end
	end)
end)

Script:

local Event = game.ReplicatedStorage.Break

Event.OnServerEvent:Connect(function(Player,hit)
	if hit.Parent == workspace and hit.Name == "DestPart" then
	   	hit.Anchored = false
		wait(10)
		hit:Destroy()
	elseif hit.Parent:IsA("Model") and hit.Name == "DestPart" then
		for i, v in pairs(hit.Parent:GetDescendants()) do
			if v:IsA("Part") or v:IsA("MeshPart") or v:IsA("UnionOperation") then							
				v.Anchored = false
				wait(10)
				v:Destroy()
			end
		end
	end
end)

2 comments

0

Is deb = not deb an error? I've never seen that before

0

it proceeds to fire to the server

1 answer

Event:FireServer(hit.Parent,hit.Name)
--<<Try send the propertys and verify on server

2 comments

0

please read the scripts next time

0

this is the correct aswer? "it proceeds to fire to the server", client to server is better property and not object!

This discussion is preserved as it was. New answers, comments, and votes are closed.