I am a beginner to Lua and I've ran into a bit of a roadblock.
To summarize the situation:
The morph model is in ReplicatedStorage. The script is a local script and it's in the model within ReplicatedStorage so it can be replicated to the players that click on the morph button. It performs the attack animation and damages other players normally on the client-side, but doesn't affect the server.
I can't figure out a good way to turn the script into something so the damage will affect the server instead of the client.
Here's the contents of the local script:
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local dmg = true
local hmnoid = script.Parent.Humanoid
local Attack = Instance.new("Animation")
Attack.AnimationId = "http://www.roblox.com/asset/?id=4602669454"
local AttackAnim = hmnoid:LoadAnimation(Attack)
Mouse.Button1Down:connect(function()
dmg = true
AttackAnim:Play()
script.Parent.RHand.Touched:connect(function(hit)
if hit.Parent.Humanoid and dmg == true then
hit.Parent.Humanoid:TakeDamage(20)
dmg = false
end
end)
end)
If anyone has any tips or suggestions for this, I would greatly appreciate it!

1 comment
Thank you for answering. I attempted putting the damage part of the script in a server script and the attack animation in a separate local script, making it so that when the attack animation runs in the local script it would change the Disabled property of the damage server script to false. This time it would run the animation but wouldn't do any damage. Might try the remote tactic instead.