Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

OnServerEvent not working for Transformation?

Asked by 5 years ago

When I was testing a transformation code (Using Z to transform with remote events & Toolbox Localscripts, with an execution script in the workspace) I came across a large issue. When I used "OnServerEvent", it said "OnServerEvent" is not a valid member of script. When testing this with a fireball using similar if not the exact same script, minus casting time and cooldown, it worked.

    Player = game.Players.LocalPlayer
Transforming = false
Transformed = false



 game.Workspace.Powerup.OnServerEvent:Connect(function(Player, Debounce)

if Transformed == true then

Player.Character.Humanoid.MaxHealth = 100

Transformed = false

else

local Character = Player.Character or Player.CharacterAdded:wait()

Transforming = true

local Aura = Instance.new("Part", Player.Character.UpperTorso)

Aura.Transparency = 1

Aura.Anchored = true

local Aurafire = Instance.new("ParticleEmitter", Aura)

Aurafire.Texture = ("rbxassetid://242102147")

Aurafire.Color = BrickColor.new("Black")

wait(5)

Player.Character.Humanoid.MaxHealth = 200

Transforming = false

Transformed = true

end

end)
0
is this from the client and is Powerup a remote event EXpodo1234ALT 18 — 5y
0
Powerup is a remote event itchymoonfire 179 — 5y
0
And what do you mean by the client? Sorry i'm new to the coding game. itchymoonfire 179 — 5y
0
Just looked it up, and I think it's being run on the server, because the server is producing these object (Particles and stuff) for the client who fired the event. If it were just on the client I think it would only be visible to the Client. itchymoonfire 179 — 5y

1 answer

Log in to vote
0
Answered by 4 years ago

You need tp put local char = Player.Character After your first line otherwise it wont know where to find the added character

Ad

Answer this question