Help with a script

Hi,

I’m using this script currently.

local Char = game:GetService("Players").LocalPlayer.CharacterAdded:Wait()

Char.Humanoid.Died:Connect(function()

    game.ReplicatedStorage.Bobux:FireServer(Char)

end)

for some reason it isn’t working. I have a part called bobux in replicated storage the the script is a local and is inside of the workspace. I think the script may be outdated since I got it from a tutorial.

from,
file

2 Likes

This may be due to the fact that you’re only detecting for a CharacterAdded event, & not for a Character property of the player as well

Try this?

local Player = game.Players.LocalPlayer
local Char = Player.Character or Player.CharacterAdded:Wait()

Char.Humanoid.Died:Connect(function()

    game.ReplicatedStorage.Bobux:FireServer(Char)

end)

You can’t :FireSever() from a model? or did I not understand what you meant?

–X

I’m trying to make it so that when you die it will make a part drop.

1 Like

this sadly didn’t work. Im not sure what the issue is…

Make a RemoteEvent inside the Replicated Storage and Fire the Remote Event.

FireServer is not an event of a Model, you have to use a RemoteEvent or change the name of your Model (You can’t just name them the same way if you’re getting some kind of error)

Screen Shot 2021-05-14 at 8.45.55 PM

its a part not a model. Sorry ion this confused you.

the output is also not giving any errors to the code. Nor mine.

Mate

Parts do not have a FireServer() function, you need to use a RemoteEvent

They’re both different icons
image

yes. Im using a remote event. Not a remote function.

Screen Shot 2021-05-14 at 8.52.29 PM

Bruh

Ok the script that you have right now, is detecting for the Part but not the RemoteEvent

Just change your code to this:

local Player = game.Players.LocalPlayer
local Char = Player.Character or Player.CharacterAdded:Wait()

Char.Humanoid.Died:Connect(function()
    --game.ReplicatedStorage.Bobux:FireServer(Char) --Don't use this, this is referring to the Part Instance which "FireServer()" is not a function
    game.ReplicatedStorage.RemoteEvent:FireServer(Char) --Use this line, this is valid

end)

Please refer to the icon differences, you’re getting the “Bobux” part, but not the “RemoteEvent”

1 Like

lol I am using a remote event. That image isn’t up to date to the current one

Ok then what’s your updated image REEEE

If both of the names are the same, change your RemoteEvent Instance to something else (Such as BobuxRemote)

We can’t really help you much if you don’t give more information on this issue here

okay. heres more information. Im making a part which is currently in replicated storage called bobux. I’m trying to make it so when you die it drops. The issue is that its not working.

I don’t have much information since its a small issue.

okay. well guys I can’t really find a solution here. So I don’t know really what to do and I’m going too find another way to do this.

but thanks for your help! even though they didn’t work I appreciate your efforts to try and help me.

I just realized this until now oh my gosh

LocalScripts cannot work if they’re parented into the workspace

Change the position of the LocalScript and put it in StarterPlayerScripts instead please