my script detects a msg from the player firing an event that tells a local script to make the part appear for the client. but when it does appear. it doesnt work when touched.
local script (rep storage)
script.Parent.OnClientEvent:Connect(function(plr)
local glob = game.ReplicatedStorage.Globs["Deep Sea Glob"]
glob.Parent = workspace.Globs["Main Island"]
script.Parent.Sound:Play()
--glob.Sound:Play()
end)
touch script (in the part)
CD = false
BS = game:GetService("BadgeService")
script.Parent.Touched:Connect(function(Hit)
print("yo1")
if Hit.Parent:IsA("Model") and Hit.Parent:FindFirstChildWhichIsA("Humanoid") ~= nil and not CD then
print("yo")
local plr = game.Players:GetPlayerFromCharacter(Hit.Parent)
if plr ~= nil then
task.wait(1)
BS:AwardBadge(plr.UserId, script.Parent.BadgeId.Value)
plr.PlayerGui.Dex.Main.Glob.Obtained = true
plr.PlayerGui.Dex.GlobMains.GlobMain.Description.Text =
script.Parent.Description.Text
CD = true
task.wait(1)
CD = false
end
end
end)
server script (sss)
local plrs = game:GetService("Players")
local canactivate = true
plrs.PlayerAdded:Connect(function(plr)
plr.Chatted:Connect(function(msg)
if msg == "/e INTHESAND" and canactivate then
game.ReplicatedStorage.Events.DeepSea:FireClient(plr)
canactivate = false
task.wait(3)
canactivate = true
end
end)
end)